package com.example.jikeyoujikeyou.office_sz.view.base;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.jikeyoujikeyou.office_sz.comment.utils.ListValidate;

import java.util.List;

/**
 * Created by sziit on 2017/12/28.
 */

public class OfficePageAdapter extends FragmentPagerAdapter {
    List<BaseFragment> fragments;

    public OfficePageAdapter(FragmentManager fm, List<BaseFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }


    @Override
    public Fragment getItem(int position) {
        return ListValidate.isEmpty(fragments) ? null : fragments.get(position);
    }

    @Override
    public int getCount() {
        return ListValidate.isEmpty(fragments) ? 0 : fragments.size();

    }
}
